Crate term_table[−][src]
Expand description
The purpose of term-table is to make it easy for CLI apps to display data in a table format
Example
Here is an example of how to create a simple table
use term_table::table_cell::TableCell;
use term_table::row::Row;
let mut table = term_table::Table::new();
table.max_column_width = 40;
table.style = term_table::TableStyle::extended();
table.add_row(Row::new(vec![
TableCell::new_with_alignment("This is some centered text", 2, term_table::table_cell::Alignment::Center)
]));
table.add_row(Row::new(vec![
TableCell::new("This is left aligned text"),
TableCell::new_with_alignment("This is right aligned text", 1, term_table::table_cell::Alignment::Right)
]));
table.add_row(Row::new(vec![
TableCell::new("This is left aligned text"),
TableCell::new_with_alignment("This is right aligned text", 1, term_table::table_cell::Alignment::Right)
]));
table.add_row(Row::new(vec![
TableCell::new_with_col_span("This is some really really really really really really really really really that is going to wrap to the next line", 2),
]));
println!("{}", table.render());
This is the result
╔═════════════════════════════════════════════════════════════════════════════════╗ ║ This is some centered text ║ ╠════════════════════════════════════════╦════════════════════════════════════════╣ ║ This is left aligned text ║ This is right aligned text ║ ╠════════════════════════════════════════╬════════════════════════════════════════╣ ║ This is left aligned text ║ This is right aligned text ║ ╠════════════════════════════════════════╩════════════════════════════════════════╣ ║ This is some really really really really really really really really really tha ║ ║ t is going to wrap to the next line ║ ╚═════════════════════════════════════════════════════════════════════════════════╝
Modules
Structs
A set of rows containing data
Used to create non-mutable tables
A set of characters which make up a table style
Enums
Represents the vertical position of a row